Imports System.IO

Public Class clsGenerateDesigner

  Public Sub mPrControlCollection(ByVal aControlCollection As Collection _
                                , ByVal aStrFormName As String _
                                , ByVal aStrBaseForm As String _
                                , ByVal aStrFormCptn As String _
                                , ByVal aIntFormHeight As Integer _
                                , ByVal aIntFormWidth As Integer)

    Dim lStrData As String = ""
    Dim lIntControlsCount As Integer
    Dim lStrControlName As String
    Dim lStrControlType As String
    Dim lStrControlCaption As String
    Dim lIntTabIndex As Integer
    Dim lStrFriendEventsString As String = ""
    Dim lIntCounter As Integer = 0
    Dim lStrFormName As String = ""
    Dim lStrParentFormName As String = ""
    Dim lStrFormCaption As String = ""
    Dim lIntControlHeight As String = ""
    Dim lIntControlWidth As String = ""
    Dim lIntControlXCood As String = ""
    Dim lIntControlYCood As String = ""
    Dim lStrPanelEnding As String = ""

    '=======================================ARIZ====================
    Dim lIntDGRSerialNumberCounter As Integer = 0
    Dim lIntDGRBodySerialNumber As Integer = 0
    Dim lStrPanelText As String = ""
    Dim lStrChildControls As String = ""
    Dim lStrParentControlDscrpn As String = ""

    '===============================================================



    lIntTabIndex = 1

    lIntControlsCount = aControlCollection.Count

    lStrData = ""

    lStrData = lStrData & "<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _" + vbCrLf

    lStrData = lStrData & "Partial Class " + aStrFormName + vbCrLf

    lStrData = lStrData & "  Inherits TCS.NGCNYTS.DWS." + aStrBaseForm + vbCrLf


    lStrData = lStrData & "'Form overrides dispose to clean up the component list."
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "<System.Diagnostics.DebuggerNonUserCode()> _"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Protected Overrides Sub Dispose(ByVal disposing As Boolean)"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "If Disposing AndAlso components IsNot Nothing Then"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "components.Dispose()"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "End If"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "MyBase.Dispose(Disposing)"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "End Sub"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "'Required by the Windows Form Designer"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Private components As System.ComponentModel.IContainer"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "'NOTE: The following procedure is required by the Windows Form Designer"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "'It can be modified using the Windows Form Designer. "
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "'Do not modify it using the code editor."
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "<System.Diagnostics.DebuggerStepThrough()> _"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & " Private Sub InitializeComponent()"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Me.components = New System.ComponentModel.Container"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Dim resources As System.ComponentModel.ComponentResourceManager " & _
                          "= New System.ComponentModel.ComponentResourceManager(GetType(" & aStrFormName & "))"

    lStrData = lStrData & vbCrLf
    lStrData = lStrData & vbCrLf

    For lIntCounter = 1 To lIntControlsCount

      lStrControlType = aControlCollection.Item(lIntCounter).pvst_ctrl_indc
      lStrControlName = aControlCollection.Item(lIntCounter).pvst_ctrl_idnt

      Select Case (lStrControlType)


        Case "GroupBox", "grpx"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New System.Windows.Forms.GroupBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " System.Windows.Forms.GroupBox" + Chr(10)
          lStrData = lStrData & vbCrLf
          lStrPanelEnding = lStrPanelEnding & vbCrLf
          lStrPanelEnding = lStrPanelEnding & "Me." & lStrControlName & ".ResumeLayout(False)" & vbCrLf
          lStrPanelEnding = lStrPanelEnding & vbCrLf
          lStrPanelEnding = lStrPanelEnding & "Me." & lStrControlName & ".PerformLayout()"
          lStrPanelEnding = lStrPanelEnding & vbCrLf

        Case "ctlButton", "btnx"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " =  New com.TCS.NGCNYTS.DWS.ctlButton"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlButton" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlCheckBox", "chbk"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " =  New com.TCS.NGCNYTS.DWS.ctlCheckBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlCheckBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlComboBox", "cmbo"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.FormatControls.ctlComboBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.FormatControls.ctlComboBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlDataEntryTxtBox", "detb"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.FormatControls.ctlDataEntryTxtBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.FormatControls.ctlDataEntryTxtBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlDataGrid"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " =  New com.TCS.NGCNYTS.DWS.ctlDataGrid"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlDataGrid" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlDataGridView", "dgvx"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlDataGridView"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlDataGridView" + Chr(10)
          lStrData = lStrData & vbCrLf

          For lIntCntx As Integer = 0 To 3
            lIntDGRSerialNumberCounter = lIntDGRSerialNumberCounter + 1
            lStrData = lStrData & "Dim ClsSerialNumber" & lIntDGRSerialNumberCounter & _
                            " As DataTypeLib.ApplicationTypes.clsSerialNumber = " & _
                            "New DataTypeLib.ApplicationTypes.clsSerialNumber"
            lStrData = lStrData & vbCrLf

          Next

        Case "ctlLabel", "labl"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlLabel"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlLabel" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlLinkLabel", "link"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlLinkLabel"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlLinkLabel" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlMaskedTextBox", "mtbx"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlMaskedTextBox(Me.components)"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlMaskedTextBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlSearchTextBox", "stbx"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlSearchTextBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlSearchTextBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "ctlTextBox"

          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlTextBox"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlTextBox" + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "panl"


          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + " = New System.Windows.Forms.Panel"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " System.Windows.Forms.Panel" + Chr(10)

          lStrPanelText = lStrPanelText & vbCrLf

          lStrPanelText = lStrPanelText & "Me." & lStrControlName & ".SuspendLayout()" & vbCrLf
          lStrPanelEnding = lStrPanelEnding & vbCrLf

          lStrPanelEnding = lStrPanelEnding & "Me." & lStrControlName & ".ResumeLayout(False)" & vbCrLf
          lStrPanelEnding = lStrPanelEnding & vbCrLf
          lStrPanelEnding = lStrPanelEnding & "Me." & lStrControlName & ".PerformLayout()"
          lStrPanelEnding = lStrPanelEnding & vbCrLf

          lStrData = lStrData & vbCrLf

        Case "term"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + " = New com.TCS.NGCNYTS.DWS.ctlTerm"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " com.TCS.NGCNYTS.DWS.ctlTerm " + Chr(10)
          lStrData = lStrData & vbCrLf

        Case "dtpx"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + " = New System.Windows.Forms.DateTimePicker"
          lStrFriendEventsString = lStrFriendEventsString + "Friend WithEvents " + lStrControlName + " As" + _
                                                            " System.Windows.Forms.DateTimePicker" + Chr(10)
          lStrData = lStrData & vbCrLf

      End Select

    Next

    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "Me.Panel1.SuspendLayout()"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & lStrPanelText
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Me.SuspendLayout()"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "'"
    lStrData = lStrData & vbCrLf

    If Trim(lStrParentFormName) <> "" Then

      lStrData = lStrData & "'lblInstructions"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "'"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "Me.lblInstructions.Location = New System.Drawing.Point(" & CStr(aIntFormWidth) & ", 0)"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "'"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "'Panel1"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "'"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "Me.Panel1.Location = New System.Drawing.Point(0," & aIntFormHeight & ")"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "Me.Panel1.Size = New System.Drawing.Size(" & aIntFormWidth & ", 0)"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "Me.ctlCaption.mPrpCaptionText = " + Chr(34) + Trim(aStrFormName) + Chr(34)
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "Me.ctlCaption.Size = New System.Drawing.Size(" & aIntFormWidth & ", 18)"
      lStrData = lStrData & vbCrLf

    End If

    For lIntCounter = 1 To lIntControlsCount

      lStrControlName = aControlCollection.Item(lIntCounter).pvst_ctrl_idnt
      lStrControlType = aControlCollection.Item(lIntCounter).pvst_ctrl_indc
      lIntControlWidth = CStr(aControlCollection.Item(lIntCounter).pvin_wdth)
      lIntControlHeight = CStr(aControlCollection.Item(lIntCounter).pvin_hght)
      lIntControlXCood = CStr(aControlCollection.Item(lIntCounter).pvin_xpnt)
      lIntControlYCood = CStr(aControlCollection.Item(lIntCounter).pvin_ypnt)


      If aControlCollection.Item(lIntCounter).pvst_ctrl_cptn = "naxx" Then
        lStrControlCaption = ""
      Else
        lStrControlCaption = aControlCollection.Item(lIntCounter).pvst_ctrl_cptn
      End If



      lStrData = lStrData & "'"
      lStrData = lStrData & vbCrLf

      lStrData = lStrData & "'"
      lStrData = lStrData & lStrControlName
      lStrData = lStrData & vbCrLf
      lStrData = lStrData & "'"
      lStrData = lStrData & vbCrLf


      Select Case (lStrControlType)

        Case "labl"

          'lStrData = lStrData & "Me." + lStrControlName + ".AutoSize = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point( " _
                                             + CStr(lIntControlXCood) + "," + CStr(lIntControlYCood) + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "grbx"
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + "grpSeparatorOne" + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex =" + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabStop = False"
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "btnx"
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".UseVisualStyleBackColor = True"
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1


        Case "cmbo"
          lStrData = lStrData & "Me." + lStrControlName + ".FormattingEnabled = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "GroupBox", "grpx"

          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabStop = False"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlButton", "btnx"

          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".UseVisualStyleBackColor = True"
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlCheckBox", "chbk"
          lStrData = lStrData & "Me." + lStrControlName + ".AutoSize = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                    ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".UseVisualStyleBackColor = True"
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlComboBox", "cmbo"

          lStrData = lStrData & "Me." + lStrControlName + ".FormattingEnabled = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1


        Case "ctlDataEntryTxtBox", "detb"
          lStrData = lStrData & "Me." + lStrControlName + ".ControlCategory = com.TCS.NGCNYTS.DWS.FormatControls.ClsFormatHeader.EnumCtlCategory.CATEGORY_INSTRUMENT_SYMBOL"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".ErrorText = Nothing"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".FixedSize = False"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".FormatDisplay = False"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".MaxLen = 10"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".MaxLen1 = 10"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name =" + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".PrpPrecision = 0"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".ToolTipText = Nothing"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".ZeroConvRule = False"
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlDataGrid"
          lStrData = lStrData & "Me." + lStrControlName + " =  New com.TCS.NGCNYTS.DWS.ctlDataGrid"
          lStrData = lStrData & vbCrLf

        Case "ctlDataGridView", "dgvx"

          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".MinimumSize = New System.Drawing.Size(365,50)"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".mPrpBodyPopMenu = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".mPrpColDescriptorList = CType(Resources.GetObject(" & Chr(34) & _
                        lStrControlName & ".mPrpColDescriptorList" & Chr(34) & "), " & _
                        "System.Collections.Generic.List(Of com.TCS.NGCNYTS.DWS.clsGridColumnMap))"
          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + ".mPrpColumnNameDataTypeArray = Nothing"
          lStrData = lStrData & vbCrLf

          For lIntCntx As Integer = 0 To 3

            lIntDGRBodySerialNumber = lIntDGRBodySerialNumber + 1

            lStrData = lStrData & "ClsSerialNumber" & lIntDGRBodySerialNumber & ".mPrpValue = CType(0, Long)"
            lStrData = lStrData & vbCrLf

            Select Case lIntCntx

              Case 0
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpFORM_SERIAL_NUMBER = ClsSerialNumber" & lIntDGRBodySerialNumber
                lStrData = lStrData & vbCrLf

              Case 1
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpGRID_SERIAL_NUMBER = ClsSerialNumber" & lIntDGRBodySerialNumber
                lStrData = lStrData & vbCrLf
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpRowHeadersVisible = False"
                lStrData = lStrData & vbCrLf

              Case 2
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpSCHEME_SERIAL_NUMBER = ClsSerialNumber" & lIntDGRBodySerialNumber
                lStrData = lStrData & vbCrLf
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpSortExpr = Nothing"
                lStrData = lStrData & vbCrLf
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpTitlePopMenu = True"
                lStrData = lStrData & vbCrLf
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpToolBarShow = True"
                lStrData = lStrData & vbCrLf

              Case 3
                lStrData = lStrData & "Me." + lStrControlName & ".mPrpWNDW_SERIAL_NUMBER = ClsSerialNumber" & lIntDGRBodySerialNumber
                lStrData = lStrData & vbCrLf

            End Select

          Next

          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) & lStrControlName & Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf


          lIntTabIndex = lIntTabIndex + 1

        Case "ctlLabel", "labl"

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".AutoSize = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlLinkLabel", "link"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf

          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabStop = True"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Text = " + Chr(34) + lStrControlCaption + Chr(34)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "ctlMaskedTextBox", "mtbx"
          lStrData = lStrData & "Me." + lStrControlName + ".DoubleFieldFormat = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldDoubleFormat.PRICE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".FieldInputType = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldType.TYPE_DOUBLE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".PriceType = com.TCS.NGCNYTS.DWS.modConstants.EnumPriceType.cblPrice"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1


        Case "ctlSearchTextBox", "stbx"
          lStrData = lStrData & "Me." + lStrControlName + ".DoubleFieldFormat = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldDoubleFormat.PRICE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".FieldInputType = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldType.TYPE_DOUBLE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".mPrpSetCode = False"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".mPrpSetName = False"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".PriceType = com.TCS.NGCNYTS.DWS.modConstants.EnumPriceType.cblPrice"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1


        Case "ctlTextBox"

          lStrData = lStrData & "Me." + lStrControlName + ".DoubleFieldFormat = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldDoubleFormat.PRICE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".FieldInputType = com.TCS.NGCNYTS.DWS.modConstants.EnumFieldType.TYPE_DOUBLE"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Font = New System.Drawing.Font(" + Chr(34) + "Arial" + Chr(34) + _
                     ", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Location = New System.Drawing.Point(" _
                                             + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Name = " + Chr(34) + lStrControlName + Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".PriceType = com.TCS.NGCNYTS.DWS.modConstants.EnumPriceType.cblPrice"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".Size = New System.Drawing.Size(" _
                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName + ".TabIndex = " + CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "term"

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." & lStrControlName & ".BackColor = System.Drawing.Color.White"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Location = New System.Drawing.Point(" _
                                                                         + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".MaximumSize = New System.Drawing.Size(150, 20)"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".MinimumSize = New System.Drawing.Size(150, 20)"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Name = " & Chr(34) & lStrControlName & Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Size = New System.Drawing.Size(" _
                                                             + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".TabIndex = " & CStr(lIntTabIndex)
          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

        Case "dtpx"

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Format = System.Windows.Forms.DateTimePickerFormat.[Short]"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Location = New System.Drawing.Point(" _
                                                                         + lIntControlXCood + "," + lIntControlYCood + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Name = " & Chr(34) & lStrControlName & Chr(34)
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Size = New System.Drawing.Size(" _
                                                                + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".TabIndex = " & CStr(lIntTabIndex)

          lIntTabIndex = lIntTabIndex + 1

        Case "panl"

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Location = New System.Drawing.Point(" _
                                                                + lIntControlXCood + "," + lIntControlYCood + ")"

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Name = " & Chr(34) & lStrControlName & Chr(34)

          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".Size = New System.Drawing.Size(" _
                                                            + lIntControlWidth + "," + lIntControlHeight + ")"
          lStrData = lStrData & vbCrLf
          lStrData = lStrData & "Me." + lStrControlName & ".TabIndex = " & CStr(lIntTabIndex)

          lStrData = lStrData & vbCrLf

          lIntTabIndex = lIntTabIndex + 1

      End Select

    Next


    lStrData = lStrData & "'"
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "'"
    lStrData = lStrData & aStrFormName
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "'"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 14.0!)"
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "Me.ClientSize = New System.Drawing.Size(" & aIntFormWidth & "," & aIntFormHeight & ")"
    lStrData = lStrData & vbCrLf


    For lIntCounter = 1 To lIntControlsCount
      lStrControlName = ""
      lStrControlName = aControlCollection(lIntCounter).pvst_ctrl_idnt
      lStrParentControlDscrpn = ""
      lStrParentControlDscrpn = aControlCollection(lIntCounter).pvst_prnt_ctrl_idnt
      If lStrParentControlDscrpn = "form" Then
        lStrData = lStrData & "Me.Controls.Add(Me." + lStrControlName + ")"
        lStrData = lStrData & vbCrLf
      Else

        lStrData = lStrData & "Me." & lStrParentControlDscrpn & _
                              ".Controls.Add(Me." & lStrControlName & ")"
        lStrData = lStrData & vbCrLf
      End If

    Next

    lStrData = lStrData & "Me.mPrpCaption = " + Chr(34) + aStrFormCptn + Chr(34)
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "Me.Name = " + Chr(34) + aStrFormName + Chr(34)
    lStrData = lStrData & vbCrLf

    For lIntCounter = 1 To lIntControlsCount

      lStrControlName = aControlCollection(lIntCounter).pvst_ctrl_idnt
      lStrParentControlDscrpn = ""
      lStrParentControlDscrpn = aControlCollection(lIntCounter).pvst_prnt_ctrl_idnt
      If lStrParentControlDscrpn = "form" Then
        lStrData = lStrData & "Me.Controls.SetChildIndex(Me." + lStrControlName + " , 0) "
        lStrData = lStrData & vbCrLf

      End If

    Next

    If Trim(aStrFormName) <> "" Then
      lStrData = lStrData & vbCrLf
      lStrData = lStrData & "Me.Panel1.ResumeLayout(False)"
      lStrData = lStrData & vbCrLf
      lStrData = lStrData & "Me.Panel1.PerformLayout()"
      lStrData = lStrData & vbCrLf

    End If
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & lStrPanelEnding
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "Me.ResumeLayout(False)"
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "Me.PerformLayout()"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & "End Sub"
    lStrData = lStrData & vbCrLf

    lStrData = lStrData & lStrFriendEventsString
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & "End Class"
    lStrData = lStrData & vbCrLf

    Dim lObjGenerateFile As New clsGnrtFile

    If lObjGenerateFile.mprGnrtDesignerFile(lStrData, aStrFormName, "Designer Files") = True Then
      MessageBox.Show("Designer File Generated")

    End If
    lStrData = ""
    lStrData = lStrData & "Public Class " & aStrFormName & vbCrLf
    lStrData = lStrData & vbCrLf
    lStrData = lStrData & " End Class"

    If lObjGenerateFile.mprGnrtDesignerFile(lStrData, aStrFormName, "Designer Files") = True Then
      MessageBox.Show("Main File Generated")

    End If

  End Sub
End Class
